From 178077a3a93d3971bc9bed6b3e99db0a0f06907d Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Sat, 14 Jul 2018 17:01:41 -0600 Subject: [PATCH] use reinterpret_cast with queues. --- arcdist.cc | 2 +- bcr.cc | 8 ++++---- bend.cc | 4 ++-- csv_util.cc | 4 ++-- defs.h | 12 ++++++------ duplicate.cc | 2 +- exif.cc | 38 +++++++++++++++++++------------------- garmin.cc | 2 +- garmin_gpi.cc | 16 ++++++++-------- gdb.cc | 12 ++++++------ ggv_log.cc | 2 +- ggv_ovl.cc | 4 ++-- gpx.cc | 2 +- gtm.cc | 2 +- igc.cc | 42 +++++++++++++++++++++--------------------- inifile.cc | 10 +++++----- interpolate.cc | 4 ++-- kml.cc | 22 +++++++++++----------- lowranceusr4.cc | 2 +- magproto.cc | 6 +++--- mapasia.cc | 2 +- mapsource.cc | 6 +++--- mkshort.cc | 4 ++-- mmo.cc | 4 ++-- netstumbler.cc | 2 +- nmea.cc | 6 +++--- pocketfms_fp.cc | 4 ++-- polygon.cc | 4 ++-- position.cc | 2 +- radius.cc | 4 ++-- route.cc | 20 ++++++++++---------- session.cc | 6 +++--- sort.cc | 4 ++-- stackfilter.cc | 4 ++-- stmsdf.cc | 2 +- tomtom.cc | 2 +- tpo.cc | 2 +- trackfilter.cc | 30 +++++++++++++++--------------- transform.cc | 2 +- waypt.cc | 8 ++++---- xcsv.cc | 4 ++-- 41 files changed, 159 insertions(+), 159 deletions(-) diff --git a/arcdist.cc b/arcdist.cc index 098b69c48..e929b10ec 100644 --- a/arcdist.cc +++ b/arcdist.cc @@ -158,7 +158,7 @@ void ArcDistanceFilter::process() foreach (Waypoint* wp, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* wp = (Waypoint*) elem; + Waypoint* wp = reinterpret_cast(elem); #endif extra_data* ed = (extra_data*) wp->extra_data; wp->extra_data = nullptr; diff --git a/bcr.cc b/bcr.cc index ce1e61167..5673327c5 100644 --- a/bcr.cc +++ b/bcr.cc @@ -207,7 +207,7 @@ bcr_create_waypts_from_route(route_head* route) queue* elem, *tmp; QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) { - Waypoint* wpt = new Waypoint(*(Waypoint*) elem); + Waypoint* wpt = new Waypoint(*reinterpret_cast(elem)); waypt_add(wpt); } } @@ -385,7 +385,7 @@ bcr_route_header(const route_head* route) int i = 0; QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*) elem; + Waypoint* wpt = reinterpret_cast(elem); i++; @@ -403,7 +403,7 @@ bcr_route_header(const route_head* route) i = 0; QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) { i++; - wpt = (Waypoint*) elem; + wpt = reinterpret_cast(elem); bcr_wgs84_to_mercator(wpt->latitude, wpt->longitude, &north, &east); @@ -431,7 +431,7 @@ bcr_route_header(const route_head* route) QString s2; i++; - wpt = (Waypoint*) elem; + wpt = reinterpret_cast(elem); QString s1 = wpt->notes; if (s1.isEmpty()) { s1 = wpt->description; diff --git a/bend.cc b/bend.cc index f70f392b9..38c2e0456 100644 --- a/bend.cc +++ b/bend.cc @@ -95,7 +95,7 @@ void BendFilter::process_route(const route_head* route_orig, route_head* route_d queue* elem, *tmp; QUEUE_FOR_EACH(&route_orig->waypoint_list, elem, tmp) { - Waypoint* wpt_orig_next = (Waypoint*)elem; + Waypoint* wpt_orig_next = reinterpret_cast(elem); if (wpt_orig_prev == nullptr) { if (wpt_orig != nullptr) { @@ -160,7 +160,7 @@ void BendFilter::process() { queue* elem, *tmp; QUEUE_FOR_EACH(routes_orig, elem, tmp) { - route_head* route_orig = (route_head*)elem; + route_head* route_orig = reinterpret_cast(elem); process_route_orig(route_orig); } } diff --git a/csv_util.cc b/csv_util.cc index b01a2bcb4..177105a70 100644 --- a/csv_util.cc +++ b/csv_util.cc @@ -1471,7 +1471,7 @@ xcsv_data_read(void) * off the beginning of buff since there's no index into queue. */ while (s) { - field_map_t* fmp = (field_map_t*) elem; + field_map_t* fmp = reinterpret_cast(elem); xcsv_parse_val(s, wpt_tmp, fmp, &trk); elem = QUEUE_NEXT(elem); @@ -1632,7 +1632,7 @@ xcsv_waypt_pr(const Waypoint* wpt) */ int field_is_unknown = 0; - field_map_t* fmp = (field_map_t*) elem; + field_map_t* fmp = reinterpret_cast(elem); if ((i != 0) && !(fmp->options & OPTIONS_NODELIM)) { *xcsv_file.stream << write_delimiter; diff --git a/defs.h b/defs.h index b3e48a866..f2955ec1b 100644 --- a/defs.h +++ b/defs.h @@ -605,7 +605,7 @@ waypt_disp_session(const session_t* se, T cb) #else queue* elem, *tmp; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* waypointp = (Waypoint*) elem; + Waypoint* waypointp = reinterpret_cast(elem); #endif if ((se == nullptr) || (waypointp->session == se)) { if (global_opts.verbose_status) { @@ -717,7 +717,7 @@ route_disp(const route_head* rh, T cb) // cb != nullptr, caught with an overload of route_disp QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { Waypoint* waypointp; - waypointp = (Waypoint*) elem; + waypointp = reinterpret_cast(elem); cb(waypointp); } } @@ -729,7 +729,7 @@ common_disp_all(queue* qh, T1 rh, T2 rt, T3 wc) queue* elem, *tmp; QUEUE_FOR_EACH(qh, elem, tmp) { const route_head* rhp; - rhp = (route_head*) elem; + rhp = reinterpret_cast(elem); // rh != nullptr, caught with an overload of common_disp_all rh(rhp); route_disp(rhp, wc); @@ -745,7 +745,7 @@ common_disp_all(queue* qh, std::nullptr_t /* rh */, T2 rt, T3 wc) queue* elem, *tmp; QUEUE_FOR_EACH(qh, elem, tmp) { const route_head* rhp; - rhp = (route_head*) elem; + rhp = reinterpret_cast(elem); // rh == nullptr route_disp(rhp, wc); // rt != nullptr, caught with an overload of common_disp_all @@ -760,7 +760,7 @@ common_disp_all(queue* qh, T1 rh, std::nullptr_t /* rt */, T3 wc) queue* elem, *tmp; QUEUE_FOR_EACH(qh, elem, tmp) { const route_head* rhp; - rhp = (route_head*) elem; + rhp = reinterpret_cast(elem); // rh != nullptr, caught with an overload of common_disp_all rh(rhp); route_disp(rhp, wc); @@ -775,7 +775,7 @@ common_disp_all(queue* qh, std::nullptr_t /* rh */, std::nullptr_t /* rt */, T3 queue* elem, *tmp; QUEUE_FOR_EACH(qh, elem, tmp) { const route_head* rhp; - rhp = (route_head*) elem; + rhp = reinterpret_cast(elem); // rh == nullptr route_disp(rhp, wc); // rt == nullptr diff --git a/duplicate.cc b/duplicate.cc index 6db106098..41ddf99a5 100644 --- a/duplicate.cc +++ b/duplicate.cc @@ -156,7 +156,7 @@ void DuplicateFilter::process(void) bh->wpt = waypointp; #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - bh->wpt = (Waypoint*) elem; + bh->wpt = reinterpret_cast(elem); #endif bh->index = i; i ++; diff --git a/exif.cc b/exif.cc index a31220b41..677e2f34f 100644 --- a/exif.cc +++ b/exif.cc @@ -310,7 +310,7 @@ exif_release_ifd(exif_ifd_t* ifd) queue* elem, *tmp; QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_release_tag((exif_tag_t*)elem); + exif_release_tag(reinterpret_cast(elem)); } xfree(ifd); } @@ -323,7 +323,7 @@ exif_release_apps() QUEUE_FOR_EACH(&exif_apps, e0, t0) { queue* e1, *t1; - exif_app_t* app = (exif_app_t*)dequeue(e0); + exif_app_t* app = reinterpret_cast(dequeue(e0)); if (app->fcache) { gbfclose(app->fcache); @@ -332,7 +332,7 @@ exif_release_apps() gbfclose(app->fexif); } QUEUE_FOR_EACH(&app->ifds, e1, t1) { - exif_ifd_t* ifd = (exif_ifd_t*)dequeue(e1); + exif_ifd_t* ifd = reinterpret_cast(dequeue(e1)); exif_release_ifd(ifd); } xfree(app); @@ -347,7 +347,7 @@ exif_ifd_size(exif_ifd_t* ifd) res += (ifd->count * 12); QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_tag_t* tag = (exif_tag_t*)elem; + exif_tag_t* tag = reinterpret_cast(elem); if (tag->size > 4) { uint32_t size = tag->size; if (size & 1) { @@ -480,7 +480,7 @@ exif_read_ifd(exif_app_t* app, const uint16_t ifd_nr, gbsize_t offs, ifd->next_ifd = gbfgetuint32(fin); QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_tag_t* tag = (exif_tag_t*)elem; + exif_tag_t* tag = reinterpret_cast(elem); if ((tag->size > 4) && (tag->value)) { tag->data = xmalloc(tag->size); tag->data_is_dynamic = 1; @@ -611,7 +611,7 @@ exif_find_ifd(exif_app_t* app, const uint16_t ifd_nr) queue* e0, *t0; QUEUE_FOR_EACH(&app->ifds, e0, t0) { - exif_ifd_t* ifd = (exif_ifd_t*)e0; + exif_ifd_t* ifd = reinterpret_cast(e0); if (ifd->nr == ifd_nr) { return ifd; @@ -627,7 +627,7 @@ exif_find_tag(exif_app_t* app, const uint16_t ifd_nr, const uint16_t tag_id) if (ifd != nullptr) { queue* elem, *tmp; QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_tag_t* tag = (exif_tag_t*)elem; + exif_tag_t* tag = reinterpret_cast(elem); if (tag->id == tag_id) { return tag; } @@ -684,7 +684,7 @@ exif_waypt_from_exif_app(exif_app_t* app) wpt->longitude = unknown_alt; QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - tag = (exif_tag_t*)elem; + tag = reinterpret_cast(elem); switch (tag->id) { case GPS_IFD_TAG_VERSION: @@ -1096,8 +1096,8 @@ exif_find_wpt_by_name(const Waypoint* wpt) static int exif_sort_tags_cb(const queue* A, const queue* B) { - exif_tag_t* ta = (exif_tag_t*)A; - exif_tag_t* tb = (exif_tag_t*)B; + const exif_tag_t* ta = reinterpret_cast(A); + const exif_tag_t* tb = reinterpret_cast(B); return ta->id - tb->id; } @@ -1105,8 +1105,8 @@ exif_sort_tags_cb(const queue* A, const queue* B) static int exif_sort_ifds_cb(const queue* A, const queue* B) { - exif_ifd_t* ia = (exif_ifd_t*)A; - exif_ifd_t* ib = (exif_ifd_t*)B; + const exif_ifd_t* ia = reinterpret_cast(A); + const exif_ifd_t* ib = reinterpret_cast(B); return ia->nr - ib->nr; } @@ -1143,7 +1143,7 @@ exif_write_ifd(const exif_ifd_t* ifd, const char next, gbfile* fout) gbsize_t offs = gbftell(fout) + (ifd->count * 12) + 4; QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_tag_t* tag = (exif_tag_t*)elem; + exif_tag_t* tag = reinterpret_cast(elem); gbfputuint16(tag->id, fout); gbfputuint16(tag->type, fout); @@ -1167,7 +1167,7 @@ exif_write_ifd(const exif_ifd_t* ifd, const char next, gbfile* fout) } QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_tag_t* tag = (exif_tag_t*)elem; + exif_tag_t* tag = reinterpret_cast(elem); if (tag->size > 4) { char* ptr = (char*) tag->data; @@ -1217,7 +1217,7 @@ exif_write_apps() gbfputuint16(0xFFD8, fout); QUEUE_FOR_EACH(&exif_apps, e0, t0) { - exif_app_t* app = (exif_app_t*)e0; + exif_app_t* app = reinterpret_cast(e0); gbfputuint16(app->marker, fout); @@ -1232,7 +1232,7 @@ exif_write_apps() sortqueue(&exif_app->ifds, exif_sort_ifds_cb); QUEUE_FOR_EACH(&app->ifds, e1, t1) { - exif_ifd_t* ifd = (exif_ifd_t*)e1; + exif_ifd_t* ifd = reinterpret_cast(e1); if (ifd->nr == GPS_IFD) { exif_put_long(IFD0, IFD0_TAG_GPS_IFD_OFFS, 0, len); @@ -1252,7 +1252,7 @@ exif_write_apps() } QUEUE_FOR_EACH(&app->ifds, e1, t1) { - exif_ifd_t* ifd = (exif_ifd_t*)e1; + exif_ifd_t* ifd = reinterpret_cast(e1); sortqueue(&ifd->tags, exif_sort_tags_cb); } @@ -1264,8 +1264,8 @@ exif_write_apps() gbfputuint32(0x08, ftmp); /* offset to first IFD */ QUEUE_FOR_EACH(&app->ifds, e1, t1) { - exif_ifd_t* ifd = (exif_ifd_t*)e1; - exif_ifd_t* ifd_next = (exif_ifd_t*)t1; + exif_ifd_t* ifd = reinterpret_cast(e1); + exif_ifd_t* ifd_next = reinterpret_cast(t1); char next; if ((ifd->nr == IFD0) && (ifd_next->nr == IFD1)) { diff --git a/garmin.cc b/garmin.cc index 16060d47c..0757d6e2e 100644 --- a/garmin.cc +++ b/garmin.cc @@ -931,7 +931,7 @@ waypoint_prepare() foreach(Waypoint* wpt, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* wpt = (Waypoint*) elem; + Waypoint* wpt = reinterpret_cast(elem); #endif char obuf[256]; diff --git a/garmin_gpi.cc b/garmin_gpi.cc index 9bb2c5852..f60092a04 100644 --- a/garmin_gpi.cc +++ b/garmin_gpi.cc @@ -766,8 +766,8 @@ write_string(const char* str, const char long_format) static int compare_wpt_cb(const queue* a, const queue* b) { - const Waypoint* wa = (Waypoint*) a; - const Waypoint* wb = (Waypoint*) b; + const Waypoint* wa = reinterpret_cast(a); + const Waypoint* wb = reinterpret_cast(b); return wa->shortname.compare(wb->shortname); } @@ -794,7 +794,7 @@ wdata_free(writer_data_t* data) queue* elem, *tmp; QUEUE_FOR_EACH(&data->Q, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); if (wpt->extra_data) { gpi_waypt_t* dt = (gpi_waypt_t*) wpt->extra_data; @@ -852,7 +852,7 @@ wdata_check(writer_data_t* data) double center_lat = center_lon = 0; QUEUE_FOR_EACH(&data->Q, elem, tmp) { - Waypoint* wpt = (Waypoint*) elem; + Waypoint* wpt = reinterpret_cast(elem); center_lat += wpt->latitude; center_lon += wpt->longitude; } @@ -860,7 +860,7 @@ wdata_check(writer_data_t* data) center_lon /= data->ct; QUEUE_FOR_EACH(&data->Q, elem, tmp) { - Waypoint* wpt = (Waypoint*) elem; + Waypoint* wpt = reinterpret_cast(elem); writer_data_t** ref; if (wpt->latitude < center_lat) { @@ -915,7 +915,7 @@ wdata_compute_size(writer_data_t* data) res = 23; /* bounds, ... of tag 0x80008 */ QUEUE_FOR_EACH(&data->Q, elem, tmp) { - Waypoint* wpt = (Waypoint*) elem; + Waypoint* wpt = reinterpret_cast(elem); garmin_fs_t* gmsd; res += 12; /* tag/sz/sub-sz */ @@ -1081,7 +1081,7 @@ wdata_write(const writer_data_t* data) QUEUE_FOR_EACH(&data->Q, elem, tmp) { int s1; - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); gpi_waypt_t* dt = (gpi_waypt_t*) wpt->extra_data; QString str = wpt->description; @@ -1268,7 +1268,7 @@ enum_waypt_cb(const Waypoint* ref) queue* elem, *tmp; QUEUE_FOR_EACH(&wdata->Q, elem, tmp) { - Waypoint* cmp = (Waypoint*) elem; + Waypoint* cmp = reinterpret_cast(elem); /* sort out nearly equal waypoints */ if ((compare_strings(cmp->shortname, ref->shortname) == 0) && diff --git a/gdb.cc b/gdb.cc index bd54c2c53..ad768571a 100644 --- a/gdb.cc +++ b/gdb.cc @@ -100,7 +100,7 @@ gdb_flush_waypt_queue(queue* Q) queue* elem, *tmp; QUEUE_FOR_EACH(Q, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); dequeue(elem); if (wpt->extra_data) { #if NEW_STRINGS @@ -289,7 +289,7 @@ gdb_find_wayptq(const queue* Q, const Waypoint* wpt, const char exact) QString name = wpt->shortname; QUEUE_FOR_EACH(Q, elem, tmp) { - Waypoint* tmp = (Waypoint*)elem; + Waypoint* tmp = reinterpret_cast(elem); if (name.compare(tmp->shortname,Qt::CaseInsensitive) == 0) { if (! exact) { return tmp; @@ -1395,7 +1395,7 @@ route_compute_bounds(const route_head* rte, bounds* bounds) queue* elem, *tmp; waypt_init_bounds(bounds); QUEUE_FOR_EACH((queue*)&rte->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); gdb_check_waypt(wpt); waypt_add_to_bounds(bounds, wpt); } @@ -1440,8 +1440,8 @@ write_route(const route_head* rte, const QString& rte_name) QUEUE_FOR_EACH((queue*)&rte->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; - Waypoint* next = (Waypoint*)tmp; + Waypoint* wpt = reinterpret_cast(elem); + Waypoint* next = reinterpret_cast(tmp); index++; rtept_ct++; /* increase informational number of written route points */ @@ -1542,7 +1542,7 @@ write_track(const route_head* trk, const QString& trk_name) FWRITE_i32(points); /* total number of waypoints in waypoint list */ QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); trkpt_ct++; /* increase informational number of written route points */ diff --git a/ggv_log.cc b/ggv_log.cc index b2317f776..0806a41b0 100644 --- a/ggv_log.cc +++ b/ggv_log.cc @@ -202,7 +202,7 @@ ggv_log_track_head_cb(const route_head* trk) QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) { double course = 0, speed = 0; struct tm tm; - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); double secs = 0; int latint = wpt->latitude; diff --git a/ggv_ovl.cc b/ggv_ovl.cc index a1d108012..263addefb 100644 --- a/ggv_ovl.cc +++ b/ggv_ovl.cc @@ -283,7 +283,7 @@ track_disp_cb(const route_head* trk) QUEUE_FOR_EACH(&(trk->waypoint_list), elem, tmp) { - Waypoint* wpt = (Waypoint*) elem; + Waypoint* wpt = reinterpret_cast(elem); gbfprintf(fout, "XKoord%d=%0.8f\n", i, wpt->longitude); gbfprintf(fout, "YKoord%d=%0.8f\n", i, wpt->latitude); @@ -313,7 +313,7 @@ route_disp_cb(const route_head* rte) QUEUE_FOR_EACH(&(rte->waypoint_list), elem, tmp) { - Waypoint* wpt = (Waypoint*) elem; + Waypoint* wpt = reinterpret_cast(elem); if (prev != nullptr) { draw_symbol_basics(OVL_SYMBOL_TRIANGLE, 1, (OVL_COLOR_TYP)9 /* color */, prev); diff --git a/gpx.cc b/gpx.cc index eb4d84f39..0031080fc 100644 --- a/gpx.cc +++ b/gpx.cc @@ -223,7 +223,7 @@ gpx_rm_from_global(gpx_global_entry* ge) queue* elem, *tmp; QUEUE_FOR_EACH(&ge->queue, elem, tmp) { - gpx_global_entry* g = (gpx_global_entry*) dequeue(elem); + gpx_global_entry* g = reinterpret_cast(dequeue(elem)); xfree(g->tagdata); xfree(g); } diff --git a/gtm.cc b/gtm.cc index 3da5e69df..836010918 100644 --- a/gtm.cc +++ b/gtm.cc @@ -588,7 +588,7 @@ gtm_read() for (i = 0; i != ts_count && i != real_tr_count; i++) { trk_head->rte_name = fread_string(file_in); fread_discard(file_in, 12); - trk_head = (route_head*)QUEUE_NEXT(&trk_head->Q); + trk_head = reinterpret_castQUEUE_NEXT(&trk_head->Q); } /* Routes */ diff --git a/igc.cc b/igc.cc index a3216935b..2bccfaf51 100644 --- a/igc.cc +++ b/igc.cc @@ -4,7 +4,7 @@ * Refer to Appendix 1 of * http://www.fai.org:81/gliding/gnss/tech_spec_gnss.asp for the * specification of the IGC data format. This translation code was - * written when the latest ammendment list for the specification was AL6. + * written when the latest amendment list for the specification was AL6. * * Copyright (C) 2004 Chris Jones * @@ -533,8 +533,8 @@ static char* latlon2str(const Waypoint* wpt) static char str[18] = ""; // We use lround here because it: // "Returns the integral value that is nearest to x, with halfway cases rounded away from zero." - // The halfway rounding cases of *printf are not precisely defined, and can vary with implmentation. - // We don't really care which way the halfway cases go, but we want them to go that way consistenly + // The halfway rounding cases of *printf are not precisely defined, and can vary with implementation. + // We don't really care which way the halfway cases go, but we want them to go that way consistently // across implementations. // We also try to use a minimum of floating point arithmetic to minimize accumulated fp math errors. long lat_milliminutes = lround(wpt->latitude * 60000.0); @@ -590,7 +590,7 @@ static void wr_header() } // Date in header record is that of the first fix record date = !track ? current_time().toTime_t() : - ((Waypoint*) QUEUE_FIRST(&track->waypoint_list))->GetCreationTime().toTime_t(); + (reinterpret_castQUEUE_FIRST(&track->waypoint_list))->GetCreationTime().toTime_t(); if (nullptr == (tm = gmtime(&date))) { fatal(MYNAME ": Bad track timestamp\n"); @@ -662,11 +662,11 @@ static void wr_task_hdr(const route_head* rte) } // See if the takeoff and landing waypoints are there or if we need to // generate them. - const Waypoint* wpt = (Waypoint*) QUEUE_LAST(&rte->waypoint_list); + const Waypoint* wpt = reinterpret_castQUEUE_LAST(&rte->waypoint_list); if (wpt->shortname.startsWith("LANDING")) { num_tps--; } - wpt = (Waypoint*) QUEUE_FIRST(&rte->waypoint_list); + wpt = reinterpret_castQUEUE_FIRST(&rte->waypoint_list); if (wpt->shortname.startsWith("TAKEOFF")) { have_takeoff = 1; num_tps--; @@ -704,7 +704,7 @@ static void wr_task_wpt(const Waypoint* wpt) static void wr_task_tlr(const route_head* rte) { // If the landing waypoint is not supplied we need to generate it. - const Waypoint* wpt = (Waypoint*) QUEUE_LAST(&rte->waypoint_list); + const Waypoint* wpt = reinterpret_castQUEUE_LAST(&rte->waypoint_list); QString sn = wpt->shortname; // if (!wpt->shortname || strncmp(wpt->shortname, "LANDIN", 6) != 0) { if (sn.isEmpty() || !sn.startsWith("LANDIN")) { @@ -742,7 +742,7 @@ static void wr_fix_record(const Waypoint* wpt, int pres_alt, int gnss_alt) /** * Attempt to align the pressure and GNSS tracks in time. * This is useful when trying to merge a track (lat/lon/time) recorded by a - * GPS with a barograph (alt/time) recorded by a seperate instrument with + * GPS with a barograph (alt/time) recorded by a separate instrument with * independent clocks which are not closely synchronised. * @return The number of seconds to add to the GNSS track in order to align * it with the pressure track. @@ -758,44 +758,44 @@ static int correlate_tracks(const route_head* pres_track, const route_head* gnss // Deduce the landing time from the pressure altitude track based on // when we last descended to within 10m of the final track altitude. const queue* elem = QUEUE_LAST(&pres_track->waypoint_list); - double last_alt = ((Waypoint*) elem)->altitude; + double last_alt = (reinterpret_cast(elem))->altitude; do { elem = elem->prev; if (&pres_track->waypoint_list == elem) { // No track left return 0; } - alt_diff = last_alt - ((Waypoint*) elem)->altitude; + alt_diff = last_alt - (reinterpret_cast(elem))->altitude; if (alt_diff > 10.0) { // Last part of track was ascending return 0; } } while (alt_diff > -10.0); - pres_time = ((Waypoint*) elem->next)->GetCreationTime().toTime_t(); + pres_time = (reinterpret_cast(elem->next))->GetCreationTime().toTime_t(); if (global_opts.debug_level >= 1) { printf(MYNAME ": pressure landing time %s", ctime(&pres_time)); } // Deduce the landing time from the GNSS altitude track based on // when the groundspeed last dropped below a certain level. elem = QUEUE_LAST(&gnss_track->waypoint_list); - last_alt = ((Waypoint*) elem)->altitude; + last_alt = (reinterpret_cast(elem))->altitude; do { - const Waypoint* wpt = (Waypoint*) elem; + const Waypoint* wpt = reinterpret_cast(elem); elem = elem->prev; if (&gnss_track->waypoint_list == elem) { // No track left return 0; } // Get a crude indication of groundspeed from the change in lat/lon - time_diff = wpt->GetCreationTime().toTime_t() - ((Waypoint*) elem)->GetCreationTime().toTime_t(); + time_diff = wpt->GetCreationTime().toTime_t() - (reinterpret_cast(elem))->GetCreationTime().toTime_t(); speed = !time_diff ? 0 : - (fabs(wpt->latitude - ((Waypoint*) elem)->latitude) + - fabs(wpt->longitude - ((Waypoint*) elem)->longitude)) / time_diff; + (fabs(wpt->latitude - (reinterpret_cast(elem))->latitude) + + fabs(wpt->longitude - (reinterpret_cast(elem))->longitude)) / time_diff; if (global_opts.debug_level >= 2) { printf(MYNAME ": speed=%f\n", speed); } } while (speed < 0.00003); - gnss_time = ((Waypoint*) elem->next)->GetCreationTime().toTime_t(); + gnss_time = (reinterpret_cast(elem->next))->GetCreationTime().toTime_t(); if (global_opts.debug_level >= 1) { printf(MYNAME ": gnss landing time %s", ctime(&gnss_time)); } @@ -823,7 +823,7 @@ static double interpolate_alt(const route_head* track, time_t time) curr_elem = prev_elem = QUEUE_FIRST(&track->waypoint_list); } // Find the track points either side of the requested time - while (((Waypoint*) curr_elem)->GetCreationTime().toTime_t() < time) { + while ((reinterpret_cast(curr_elem))->GetCreationTime().toTime_t() < time) { if (QUEUE_LAST(&track->waypoint_list) == curr_elem) { // Requested time later than all track points, we can't interpolate return unknown_alt; @@ -832,8 +832,8 @@ static double interpolate_alt(const route_head* track, time_t time) curr_elem = QUEUE_NEXT(prev_elem); } - const Waypoint* prev_wpt = (Waypoint*) prev_elem; - const Waypoint* curr_wpt = (Waypoint*) curr_elem; + const Waypoint* prev_wpt = reinterpret_cast(prev_elem); + const Waypoint* curr_wpt = reinterpret_cast(curr_elem); if (QUEUE_FIRST(&track->waypoint_list) == curr_elem) { if (curr_wpt->GetCreationTime().toTime_t() == time) { @@ -854,7 +854,7 @@ static double interpolate_alt(const route_head* track, time_t time) } /* - * Pressure altitude and GNSS altitude may be provided in two seperate + * Pressure altitude and GNSS altitude may be provided in two separate * tracks. This function attempts to merge them into one. */ static void wr_track() diff --git a/inifile.cc b/inifile.cc index 831ee9e48..8885d8d16 100644 --- a/inifile.cc +++ b/inifile.cc @@ -176,13 +176,13 @@ inifile_find_value(const inifile_t* inifile, const char* sec_name, const char* k } QUEUE_FOR_EACH(&inifile->secs, elem, tmp) { - inifile_section_t* sec = (inifile_section_t*) elem; + inifile_section_t* sec = reinterpret_cast(elem); if (case_ignore_strcmp(sec->name, sec_name) == 0) { queue* elem, *tmp; QUEUE_FOR_EACH(&sec->entries, elem, tmp) { - inifile_entry_t* entry = (inifile_entry_t*) elem; + inifile_entry_t* entry = reinterpret_cast(elem); if (case_ignore_strcmp(entry->key, key) == 0) { return entry->val; @@ -235,13 +235,13 @@ inifile_done(inifile_t* inifile) queue* elem, *tmp; QUEUE_FOR_EACH(&inifile->secs, elem, tmp) { - inifile_section_t* sec = (inifile_section_t*) elem; + inifile_section_t* sec = reinterpret_cast(elem); if (sec->ientries > 0) { queue* elem, *tmp; QUEUE_FOR_EACH(&sec->entries, elem, tmp) { - inifile_entry_t* entry = (inifile_entry_t*) elem; + inifile_entry_t* entry = reinterpret_cast(elem); if (entry->key) { xfree(entry->key); @@ -270,7 +270,7 @@ inifile_has_section(const inifile_t* inifile, const char* section) queue* elem, *tmp; QUEUE_FOR_EACH(&inifile->secs, elem, tmp) { - inifile_section_t* sec = (inifile_section_t*) elem; + inifile_section_t* sec = reinterpret_cast(elem); if (case_ignore_strcmp(sec->name, section) == 0) { return 1; } diff --git a/interpolate.cc b/interpolate.cc index e98beb50f..2b34c669d 100644 --- a/interpolate.cc +++ b/interpolate.cc @@ -51,7 +51,7 @@ void InterpolateFilter::process() } QUEUE_FOR_EACH(backuproute, elem, tmp) { - route_head* rte_old = (route_head*)elem; + route_head* rte_old = reinterpret_cast(elem); route_head* rte_new = route_head_alloc(); rte_new->rte_name = rte_old->rte_name; @@ -65,7 +65,7 @@ void InterpolateFilter::process() } bool first = 1; QUEUE_FOR_EACH(&rte_old->waypoint_list, elem2, tmp2) { - Waypoint* wpt = (Waypoint*)elem2; + Waypoint* wpt = reinterpret_cast(elem2); if (first) { first = 0; } else { diff --git a/kml.cc b/kml.cc index 0f2fb650c..2eed103d8 100644 --- a/kml.cc +++ b/kml.cc @@ -428,7 +428,7 @@ void trk_coord(xg_string args, const QXmlStreamAttributes*) queue* curr_elem; queue* tmp_elem; QUEUE_FOR_EACH(&trk_head->waypoint_list, curr_elem, tmp_elem) { - trkpt = (Waypoint*) curr_elem; + trkpt = reinterpret_cast(curr_elem); trkpt->SetCreationTime(wpt_timespan_begin); wpt_timespan_begin = wpt_timespan_begin.addMSecs(ms_per_waypoint); } @@ -1071,7 +1071,7 @@ static void kml_output_tailer(const route_head* header) queue* elem, *tmp; QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - Waypoint* tpt = (Waypoint*) elem; + Waypoint* tpt = reinterpret_cast(elem); int first_in_trk = tpt->Q.prev == &header->waypoint_list; if (!first_in_trk && tpt->wpt_flags.new_trkseg) { needs_multigeometry = 1; @@ -1108,7 +1108,7 @@ static void kml_output_tailer(const route_head* header) } QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - Waypoint* tpt = (Waypoint*) elem; + Waypoint* tpt = reinterpret_cast(elem); int first_in_trk = tpt->Q.prev == &header->waypoint_list; if (tpt->wpt_flags.new_trkseg) { if (!first_in_trk) { @@ -1698,7 +1698,7 @@ static void kml_mt_simple_array(const route_head* header, QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*) elem; + Waypoint* wpt = reinterpret_cast(elem); switch (member) { case fld_power: @@ -1729,7 +1729,7 @@ static int track_has_time(const route_head* header) queue* elem, *tmp; int points_with_time = 0; QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - Waypoint* tpt = (Waypoint*)elem; + Waypoint* tpt = reinterpret_cast(elem); if (tpt->GetCreationTime().isValid()) { points_with_time++; @@ -1747,7 +1747,7 @@ static void write_as_linestring(const route_head* header) queue* elem, *tmp; kml_track_hdr(header); QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - Waypoint* tpt = (Waypoint*)elem; + Waypoint* tpt = reinterpret_cast(elem); kml_track_disp(tpt); } kml_track_tlr(header); @@ -1777,7 +1777,7 @@ static void kml_mt_hdr(const route_head* header) kml_output_positioning(false); QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - Waypoint* tpt = (Waypoint*)elem; + Waypoint* tpt = reinterpret_cast(elem); if (tpt->GetCreationTime().isValid()) { QString time_string = tpt->CreationTimeXML(); @@ -1790,7 +1790,7 @@ static void kml_mt_hdr(const route_head* header) // TODO: How to handle clamped, floating, extruded, etc.? QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - Waypoint* tpt = (Waypoint*)elem; + Waypoint* tpt = reinterpret_cast(elem); if (kml_altitude_known(tpt)) { writer->writeTextElement(QStringLiteral("gx:coord"), @@ -2165,9 +2165,9 @@ kml_wr_position(Waypoint* wpt) /* In order to avoid clutter while we're sitting still, don't add track points if we've not moved a minimum distance from the - beginnning of our accumulated track. */ + beginning of our accumulated track. */ { - Waypoint* newest_posn= (Waypoint*) QUEUE_LAST(&posn_trk_head->waypoint_list); + Waypoint* newest_posn= reinterpret_castQUEUE_LAST(&posn_trk_head->waypoint_list); if (radtometers(gcdist(RAD(wpt->latitude), RAD(wpt->longitude), RAD(newest_posn->latitude), RAD(newest_posn->longitude))) > 50) { @@ -2192,7 +2192,7 @@ kml_wr_position(Waypoint* wpt) */ while (max_position_points && (posn_trk_head->rte_waypt_ct >= max_position_points)) { - Waypoint* tonuke = (Waypoint*) QUEUE_FIRST(&posn_trk_head->waypoint_list); + Waypoint* tonuke = reinterpret_castQUEUE_FIRST(&posn_trk_head->waypoint_list); track_del_wpt(posn_trk_head, tonuke); } diff --git a/lowranceusr4.cc b/lowranceusr4.cc index 1b43e703a..1237dce8c 100644 --- a/lowranceusr4.cc +++ b/lowranceusr4.cc @@ -474,7 +474,7 @@ lowranceusr4_find_waypt(int uid_unit, int uid_seq_low, int uid_seq_high) foreach(Waypoint* waypointp, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* waypointp = (Waypoint*) elem; + Waypoint* waypointp = reinterpret_cast(elem); #endif fs = (lowranceusr4_fsdata*) fs_chain_find(waypointp->fs, FS_LOWRANCEUSR4); diff --git a/magproto.cc b/magproto.cc index 8bb9777f6..1dbdbe0d3 100644 --- a/magproto.cc +++ b/magproto.cc @@ -1126,14 +1126,14 @@ mag_rteparse(char* rtemsg) */ QUEUE_FOR_EACH(&mag_rte_head->Q, elem, tmp) { - mag_rte_elem* re = (mag_rte_elem*) elem; + mag_rte_elem* re = reinterpret_cast(elem); queue* welem, *wtmp; /* * Copy route points from temp wpt queue. */ QUEUE_FOR_EACH(&rte_wpt_tmp, welem, wtmp) { - Waypoint* waypt = (Waypoint*)welem; + Waypoint* waypt = reinterpret_cast(welem); if (waypt->shortname == re->wpt_name) { Waypoint* wpt = new Waypoint(*waypt); route_add_wpt(rte_head, wpt); @@ -1490,7 +1490,7 @@ mag_route_trl(const route_head* rte) int thisline = i = 0; QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - Waypoint* waypointp = (Waypoint*) elem; + Waypoint* waypointp = reinterpret_cast(elem); i++; if (deficon) { diff --git a/mapasia.cc b/mapasia.cc index c6b370eb6..651648204 100644 --- a/mapasia.cc +++ b/mapasia.cc @@ -169,7 +169,7 @@ tr7_check_after_read_trailer_cb(const route_head* trk) { queue* elem, *tmp; QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); if (speed_tmp == 0) { WAYPT_UNSET(wpt, speed); } diff --git a/mapsource.cc b/mapsource.cc index 312bebc36..146eb2f06 100644 --- a/mapsource.cc +++ b/mapsource.cc @@ -124,7 +124,7 @@ mps_wpt_q_deinit(queue* whichQueue) queue* elem, *tmp; QUEUE_FOR_EACH(whichQueue, elem, tmp) { - Waypoint* q = (Waypoint*) dequeue(elem); + Waypoint* q = reinterpret_cast(dequeue(elem)); delete q; } } @@ -1118,7 +1118,7 @@ mps_routehdr_w(gbfile* mps_file, int mps_ver, const route_head* rte) if (rte->waypoint_list.next) { /* this test doesn't do what I want i.e test if this is a valid route - treat as a placeholder for now */ QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - Waypoint* testwpt = (Waypoint*)elem; + Waypoint* testwpt = reinterpret_cast(elem); if (rte_datapoints == 0) { uniqueValue = testwpt->GetCreationTime().toTime_t(); } @@ -1546,7 +1546,7 @@ mps_trackhdr_w(gbfile* mps_file, int mps_ver, const route_head* trk) if (trk->waypoint_list.next) { /* this test doesn't do what I want i.e test if this is a valid track - treat as a placeholder for now */ QUEUE_FOR_EACH(&trk->waypoint_list, elem, tmp) { if (trk_datapoints == 0) { - Waypoint* testwpt = (Waypoint*)elem; + Waypoint* testwpt = reinterpret_cast(elem); uniqueValue = testwpt->GetCreationTime().toTime_t(); } trk_datapoints++; diff --git a/mkshort.cc b/mkshort.cc index 773770ee3..99f0f1ab7 100644 --- a/mkshort.cc +++ b/mkshort.cc @@ -111,7 +111,7 @@ is_unique(mkshort_handle_imp* h, char* name) int hash = hash_string(name); QUEUE_FOR_EACH(&h->namelist[hash], e, t) { - uniq_shortname* z = (uniq_shortname*) e; + uniq_shortname* z = reinterpret_cast(e); if (0 == case_ignore_strcmp(z->orig_shortname, name)) { return z; } @@ -167,7 +167,7 @@ mkshort_del_handle(short_handle* h) for (int i = 0; i < PRIME; i++) { queue* e, *t; QUEUE_FOR_EACH(&hdr->namelist[i], e, t) { - uniq_shortname* s = (uniq_shortname*) e; + uniq_shortname* s = reinterpret_cast(e); #if 0 if (global_opts.verbose_status >= 2 && s->conflictctr) { fprintf(stderr, "%d Output name conflicts: '%s'\n", diff --git a/mmo.cc b/mmo.cc index b615a6e4d..7adb3e675 100644 --- a/mmo.cc +++ b/mmo.cc @@ -1279,7 +1279,7 @@ mmo_write_rte_head_cb(const route_head* rte) mmo_rte = rte; QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); QDateTime t = wpt->GetCreationTime(); if ((t.isValid()) && (t.toTime_t() < time)) { time = t.toTime_t(); @@ -1323,7 +1323,7 @@ mmo_write_rte_tail_cb(const route_head* rte) } QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); int objid = mmo_get_objid(wpt); gbfputuint16(objid & 0x7FFF, fout); } diff --git a/netstumbler.cc b/netstumbler.cc index 3b43f9d17..4645f7ab4 100644 --- a/netstumbler.cc +++ b/netstumbler.cc @@ -308,7 +308,7 @@ fix_netstumbler_dupes() queue* elem, *tmp; extern queue waypt_head; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - bh->wpt = (Waypoint*) elem; + bh->wpt = reinterpret_cast(elem); #endif QString snptr = bh->wpt->shortname; QString tmp_sn = snptr.toLower(); diff --git a/nmea.cc b/nmea.cc index 8a5ec4312..f73deb26f 100644 --- a/nmea.cc +++ b/nmea.cc @@ -841,7 +841,7 @@ pcmpt_parse(char* ibuf) route_head* trk_head = route_head_alloc(); track_add_head(trk_head); QUEUE_FOR_EACH(&pcmpt_head, elem, tmp) { - Waypoint* wpt = (Waypoint*) dequeue(elem); + Waypoint* wpt = reinterpret_cast(dequeue(elem)); nmea_add_wpt(wpt, trk_head); } } @@ -867,7 +867,7 @@ nmea_fix_timestamps(route_head* track) time_t delta_tm = mkgmtime(&opt_tm); QUEUE_FOR_EACH(&track->waypoint_list, elem, temp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); wpt->creation_time += delta_tm; if ((prev != nullptr) && (prev->creation_time > wpt->creation_time)) { @@ -887,7 +887,7 @@ nmea_fix_timestamps(route_head* track) /* go backward through the track and complete timestamps */ for (queue* elem = QUEUE_LAST(&track->waypoint_list); elem != &track->waypoint_list; elem=elem->prev) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); if (wpt->wpt_flags.fmt_use != 0) { wpt->wpt_flags.fmt_use = 0; /* reset flag */ diff --git a/pocketfms_fp.cc b/pocketfms_fp.cc index f84420763..d45779cfd 100644 --- a/pocketfms_fp.cc +++ b/pocketfms_fp.cc @@ -65,8 +65,8 @@ static void rd_deinit() { if (route != nullptr) { - Waypoint* head = (Waypoint*) QUEUE_FIRST(&route->waypoint_list); - Waypoint* tail = (Waypoint*) QUEUE_LAST(&route->waypoint_list); + Waypoint* head = reinterpret_castQUEUE_FIRST(&route->waypoint_list); + Waypoint* tail = reinterpret_castQUEUE_LAST(&route->waypoint_list); if (head != nullptr) { route->rte_name = head->shortname; } diff --git a/polygon.cc b/polygon.cc index 54b13f12f..75b0e77e1 100644 --- a/polygon.cc +++ b/polygon.cc @@ -252,7 +252,7 @@ void PolygonFilter::process() foreach (Waypoint* waypointp, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypointp = (Waypoint*)elem; + waypointp = reinterpret_cast(elem); #endif if (waypointp->extra_data) { ed = (extra_data*) waypointp->extra_data; @@ -301,7 +301,7 @@ void PolygonFilter::process() foreach (Waypoint* wp, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* wp = (Waypoint*) elem; + Waypoint* wp = reinterpret_cast(elem); #endif ed = (extra_data*) wp->extra_data; wp->extra_data = nullptr; diff --git a/position.cc b/position.cc index 035c13013..ea6cc94bf 100644 --- a/position.cc +++ b/position.cc @@ -53,7 +53,7 @@ void PositionFilter::position_runqueue(queue* q, int nelems, int qtype) comp[i] = waypointp; #else QUEUE_FOR_EACH(q, elem, tmp) { - comp[i] = (Waypoint*)elem; + comp[i] = reinterpret_cast(elem); #endif qlist[i] = 0; i++; diff --git a/radius.cc b/radius.cc index 17014d25a..d4f2c996d 100644 --- a/radius.cc +++ b/radius.cc @@ -67,7 +67,7 @@ void RadiusFilter::process() foreach (Waypoint* waypointp, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* waypointp = (Waypoint*)elem; + Waypoint* waypointp = reinterpret_cast(elem); #endif double dist = gc_distance(waypointp->latitude, waypointp->longitude, @@ -105,7 +105,7 @@ void RadiusFilter::process() foreach (Waypoint* wp, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* wp = (Waypoint*) elem; + Waypoint* wp = reinterpret_cast(elem); #endif comp[i] = wp; waypt_del(wp); diff --git a/route.cc b/route.cc index 678cb5b53..5348795ed 100644 --- a/route.cc +++ b/route.cc @@ -135,7 +135,7 @@ common_route_by_name(queue* routes, const char* name) queue* elem, *tmp; QUEUE_FOR_EACH(routes, elem, tmp) { - route_head* rte = (route_head*) elem; + route_head* rte = reinterpret_cast(elem); if (rte->rte_name == name) { return rte; } @@ -217,7 +217,7 @@ route_find_waypt_by_name(route_head* rh, const char* name) queue* elem, *tmp; QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { - Waypoint* waypointp = (Waypoint*) elem; + Waypoint* waypointp = reinterpret_cast(elem); if (waypointp->shortname == name) { return waypointp; } @@ -228,8 +228,8 @@ route_find_waypt_by_name(route_head* rh, const char* name) static void any_route_del_wpt(route_head* rte, Waypoint* wpt, int* ct) { - if (wpt->wpt_flags.new_trkseg && wpt != (Waypoint*)QUEUE_LAST(&rte->waypoint_list)) { - Waypoint* wpt_next = (Waypoint*)QUEUE_NEXT(&wpt->Q); + if (wpt->wpt_flags.new_trkseg && wpt != reinterpret_castQUEUE_LAST(&rte->waypoint_list)) { + Waypoint* wpt_next = reinterpret_castQUEUE_NEXT(&wpt->Q); wpt_next->wpt_flags.new_trkseg = 1; } wpt->wpt_flags.new_trkseg = 0; @@ -274,7 +274,7 @@ common_disp_session(const session_t* se, queue* qh, route_hdr rh, route_trl rt, { queue* elem, *tmp; QUEUE_FOR_EACH(qh, elem, tmp) { - const route_head* rhp = (route_head*) elem; + const route_head* rhp = reinterpret_cast(elem); if (rhp->session == se) { if (rh) { (*rh)(rhp); @@ -306,7 +306,7 @@ route_flush_q(queue* head) QUEUE_FOR_EACH(head, elem, tmp) { queue* q = dequeue(elem); - any_route_free((route_head*) q); + any_route_free(reinterpret_cast(q)); } } @@ -339,7 +339,7 @@ route_flush(queue* head) queue* elem, *tmp; QUEUE_FOR_EACH(head, elem, tmp) { queue* q = dequeue(elem); - any_route_free((route_head*)q); + any_route_free(reinterpret_cast(q)); } } @@ -361,7 +361,7 @@ route_copy(int* dst_count, int* dst_wpt_count, queue** dst, queue* src) const char RPT[] = "RPT"; QUEUE_FOR_EACH(src, elem, tmp) { - route_head* rte_old = (route_head*)elem; + route_head* rte_old = reinterpret_cast(elem); route_head* rte_new = route_head_alloc(); rte_new->rte_name = rte_old->rte_name; @@ -371,7 +371,7 @@ route_copy(int* dst_count, int* dst_wpt_count, queue** dst, queue* src) rte_new->rte_num = rte_old->rte_num; any_route_add_head(rte_new, *dst); QUEUE_FOR_EACH(&rte_old->waypoint_list, elem2, tmp2) { - any_route_add_wpt(rte_new, new Waypoint(*(Waypoint*)elem2), dst_wpt_count, 0, RPT, 3); + any_route_add_wpt(rte_new, new Waypoint(*reinterpret_cast(elem2)), dst_wpt_count, 0, RPT, 3); } (*dst_count)++; } @@ -544,7 +544,7 @@ void track_recompute(const route_head* trk, computed_trkdata** trkdatap) tdata->max_alt = unknown_alt; QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) { - Waypoint* thisw = (Waypoint*)elem; + Waypoint* thisw = reinterpret_cast(elem); /* * gcdist and heading want radians, not degrees. diff --git a/session.cc b/session.cc index e99fd1e91..6afb27181 100644 --- a/session.cc +++ b/session.cc @@ -40,7 +40,7 @@ session_exit() queue* elem, *tmp; QUEUE_FOR_EACH(&session_list, elem, tmp) { - session_t* s = (session_t*)elem; + session_t* s = reinterpret_cast(elem); dequeue(&s->Q); session_free(s); } @@ -65,7 +65,7 @@ start_session(const char* name, const char* filename) session_t* curr_session() { - return (session_t*) session_list.prev; + return reinterpret_cast(session_list.prev); } /* in work @@ -107,7 +107,7 @@ session_free(session_t* s) { queue* elem, *tmp; QUEUE_FOR_EACH(&s->category_list, elem, tmp) { - category_t* c = (category_t*) elem; + category_t* c = reinterpret_cast(elem); dequeue(&c->Q); xfree(c); } diff --git a/sort.cc b/sort.cc index 9c1d63449..a50be2c73 100644 --- a/sort.cc +++ b/sort.cc @@ -27,8 +27,8 @@ int SortFilter::sort_comp(const queue* a, const queue* b) { - const Waypoint* x1 = (Waypoint*)a; - const Waypoint* x2 = (Waypoint*)b; + const Waypoint* x1 = reinterpret_cast(a); + const Waypoint* x2 = reinterpret_cast(b); switch (sort_mode) { case sm_gcid: diff --git a/stackfilter.cc b/stackfilter.cc index c1fea560c..9e79d3e22 100644 --- a/stackfilter.cc +++ b/stackfilter.cc @@ -45,7 +45,7 @@ void StackFilter::process() stack = tmp_elt; if (opt_copy) { QUEUE_FOR_EACH(&(stack->waypts), elem, tmp) { - waypt_add(new Waypoint(*(Waypoint*)elem)); + waypt_add(new Waypoint(*reinterpret_cast(elem))); } } @@ -72,7 +72,7 @@ void StackFilter::process() } if (opt_append) { QUEUE_FOR_EACH(&(stack->waypts), elem, tmp) { - waypt_add((Waypoint*)elem); + waypt_add(reinterpret_cast(elem)); } route_append(&(stack->routes)); route_flush(&(stack->routes)); diff --git a/stmsdf.cc b/stmsdf.cc index f48ffc15d..e45aacd55 100644 --- a/stmsdf.cc +++ b/stmsdf.cc @@ -192,7 +192,7 @@ finalize_tracks(void) int index = 0; QUEUE_FOR_EACH(&trackpts, elem, tmp) { - list[index] = (Waypoint*)elem; + list[index] = reinterpret_cast(elem); dequeue(elem); index++; } diff --git a/tomtom.cc b/tomtom.cc index 94c0d7c45..70830787f 100644 --- a/tomtom.cc +++ b/tomtom.cc @@ -443,7 +443,7 @@ data_write() foreach(Waypoint* waypointp, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* waypointp = (Waypoint*) elem; + Waypoint* waypointp = reinterpret_cast(elem); #endif bh->wpt = waypointp; if (waypointp->longitude > maxlon) { diff --git a/tpo.cc b/tpo.cc index 91d082d9e..54d04f6c1 100644 --- a/tpo.cc +++ b/tpo.cc @@ -1616,7 +1616,7 @@ tpo_track_hdr(const route_head* rte) unsigned char unknown1[] = { 0xFF, 0x00, 0x00, 0x00 }; unsigned char bounding_box[8] = { 0x00, 0x80, 0x00, 0x80, 0xFF, 0x7F, 0xFF, 0x7F }; - Waypoint* first_track_waypoint = (Waypoint*) QUEUE_FIRST(&rte->waypoint_list); + Waypoint* first_track_waypoint = reinterpret_castQUEUE_FIRST(&rte->waypoint_list); /* zoom level 1-5 visibility flags */ gbfwrite(visibility_flags, 1, sizeof(visibility_flags), tpo_file_out); diff --git a/trackfilter.cc b/trackfilter.cc index 7a0543e46..dedefae37 100644 --- a/trackfilter.cc +++ b/trackfilter.cc @@ -184,7 +184,7 @@ void TrackFilter::trackfilter_fill_track_list_cb(const route_head* track) /* ca if (opt_name != nullptr) { if (!QRegExp(opt_name, Qt::CaseInsensitive, QRegExp::WildcardUnix).exactMatch(track->rte_name)) { QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); track_del_wpt(const_cast(track), wpt); delete wpt; } @@ -201,7 +201,7 @@ void TrackFilter::trackfilter_fill_track_list_cb(const route_head* track) /* ca QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { track_pts++; - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); if (!wpt->creation_time.isValid()) { timeless_pts++; } @@ -280,7 +280,7 @@ void TrackFilter::trackfilter_pack_init_rte_name(route_head* track, const time_t if (track->rte_waypt_ct == 0) { tm = *localtime(&default_time); } else { - Waypoint* wpt = (Waypoint*) QUEUE_FIRST((queue*)&track->waypoint_list); + Waypoint* wpt = reinterpret_castQUEUE_FIRST((queue*)&track->waypoint_list); time_t t = wpt->GetCreationTime().toTime_t(); tm = *localtime(&t); } @@ -337,7 +337,7 @@ void TrackFilter::trackfilter_pack() route_head* curr = track_list[i].track; QUEUE_FOR_EACH((queue*)&curr->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); track_del_wpt(curr, wpt); track_add_wpt(master, wpt); } @@ -369,7 +369,7 @@ void TrackFilter::trackfilter_merge() for (i = 0; i < track_ct; i++) { /* put all points into temp buffer */ route_head* track = track_list[i].track; QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { - wpt = (Waypoint*)elem; + wpt = reinterpret_cast(elem); if (wpt->creation_time.isValid()) { buff[j] = new Waypoint(*wpt); // augment sort key so a stable sort is possible. @@ -536,7 +536,7 @@ void TrackFilter::trackfilter_split() i = 0; QUEUE_FOR_EACH((queue*)&master->waypoint_list, elem, tmp) { - wpt = (Waypoint*)elem; + wpt = reinterpret_cast(elem); buff[i++] = wpt; } @@ -627,7 +627,7 @@ void TrackFilter::trackfilter_move() for (int i = 0; i < track_ct; i++) { route_head* track = track_list[i].track; QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); wpt->creation_time += delta; } @@ -657,7 +657,7 @@ void TrackFilter::trackfilter_synth() route_head* track = track_list[i].track; int first = 1; QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); if (opt_fix) { wpt->fix = fix; if (wpt->sat == 0) { @@ -771,7 +771,7 @@ int TrackFilter::trackfilter_range() /* returns number of track points left aft route_head* track = track_list[i].track; QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); if (wpt->creation_time.isValid()) { inside = ((wpt->GetCreationTime().toTime_t() >= start) && (wpt->GetCreationTime().toTime_t() <= stop)); } @@ -815,7 +815,7 @@ void TrackFilter::trackfilter_seg2trk() int trk_seg_num = 1, first = 1; QUEUE_FOR_EACH((queue*)&src->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); if (wpt->wpt_flags.new_trkseg && !first) { dest = route_head_alloc(); @@ -862,7 +862,7 @@ void TrackFilter::trackfilter_trk2seg() int first = 1; QUEUE_FOR_EACH((queue*)&curr->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); int orig_new_trkseg = wpt->wpt_flags.new_trkseg; @@ -951,7 +951,7 @@ void TrackFilter::trackfilter_faketime() route_head* track = track_list[i].track; QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); if (!wpt->creation_time.isValid() || faketime.force) { wpt->creation_time = QDateTime::fromTime_t(faketime.start); @@ -995,7 +995,7 @@ void TrackFilter::trackfilter_segment_head(const route_head* rte) const double ktoo_close = 0.000005; QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - Waypoint* wpt = (Waypoint*)elem; + Waypoint* wpt = reinterpret_cast(elem); if (index > 0) { double cur_dist = gcdist(RAD(prev_wpt->latitude), RAD(prev_wpt->longitude), @@ -1007,8 +1007,8 @@ void TrackFilter::trackfilter_segment_head(const route_head* rte) } if (cur_dist < ktoo_close) { - if (wpt != (Waypoint*) QUEUE_LAST(&rte->waypoint_list)) { - Waypoint* next_wpt = (Waypoint*) QUEUE_NEXT(&wpt->Q); + if (wpt != reinterpret_castQUEUE_LAST(&rte->waypoint_list)) { + Waypoint* next_wpt = reinterpret_castQUEUE_NEXT(&wpt->Q); if (trackfilter_points_are_same(prev_wpt, wpt) && trackfilter_points_are_same(wpt, next_wpt)) { track_del_wpt(const_cast(rte), wpt); diff --git a/transform.cc b/transform.cc index 820628215..e5d563f70 100644 --- a/transform.cc +++ b/transform.cc @@ -47,7 +47,7 @@ void TransformFilter::transform_waypoints() #else queue* elem, *tmp; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* wpt = (Waypoint*) elem; + Waypoint* wpt = reinterpret_cast(elem); #endif wpt = new Waypoint(*wpt); diff --git a/waypt.cc b/waypt.cc index ff945a22b..2015b841f 100644 --- a/waypt.cc +++ b/waypt.cc @@ -260,7 +260,7 @@ waypt_compute_bounds(bounds* bounds) #else queue* elem, *tmp; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* waypointp = (Waypoint*) elem; + Waypoint* waypointp = reinterpret_cast(elem); #endif waypt_add_to_bounds(bounds, waypointp); } @@ -275,7 +275,7 @@ find_waypt_by_name(const QString& name) queue* elem, *tmp; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - Waypoint* waypointp = (Waypoint*) elem; + Waypoint* waypointp = reinterpret_cast(elem); #endif if (waypointp->shortname == name) { return waypointp; @@ -308,7 +308,7 @@ waypt_flush(queue* head) queue* elem, *tmp; QUEUE_FOR_EACH(head, elem, tmp) { - Waypoint* q = (Waypoint*) dequeue(elem); + Waypoint* q = reinterpret_cast(dequeue(elem)); delete q; if (head == &waypt_head) { waypt_ct--; @@ -351,7 +351,7 @@ waypt_backup(signed int* count, queue** head_bak) waypt_ct = 0; QUEUE_FOR_EACH(qbackup, elem, tmp) { - wpt = (Waypoint*)elem; + wpt = reinterpret_cast(elem); waypt_add(new Waypoint(*wpt)); no++; } diff --git a/xcsv.cc b/xcsv.cc index 7ab6db41f..5e68feda5 100644 --- a/xcsv.cc +++ b/xcsv.cc @@ -126,7 +126,7 @@ xcsv_destroy_style(void) /* destroy the ifields */ QUEUE_FOR_EACH(&xcsv_file.ifield, elem, tmp) { - fmp = (field_map_t*) elem; + fmp = reinterpret_cast(elem); if (fmp->key) { xfree(fmp->key); } @@ -144,7 +144,7 @@ xcsv_destroy_style(void) /* destroy the ofields, if they are not re-mapped to ifields. */ if (xcsv_file.ofield != &xcsv_file.ifield) { QUEUE_FOR_EACH(xcsv_file.ofield, elem, tmp) { - fmp = (field_map_t*) elem; + fmp = reinterpret_cast(elem); if (fmp->key) { xfree(fmp->key); } -- 2.30.2